package minidb.parse.exps;
import java.util.*;
import minidb.parse.sym;


public abstract class SQLExp
{
	public abstract String Print();
	
	
	private static Map<Integer,String> opMap;
	
	static
	{
		opMap=new HashMap<Integer,String>();
		
		java.lang.reflect.Field[] fields=sym.class.getFields();
		
		for(java.lang.reflect.Field f : fields)
		{
			try
			{
				int i=f.getInt(f);
				switch(i)
				{
					case sym.EQ:
						opMap.put(i, "=");
						break;
					case sym.NEQ:
						opMap.put(i, "<>");
						break;
					case sym.LT:
						opMap.put(i, "<");
						break;
					case sym.GT:
						opMap.put(i, ">");
						break;
					case sym.LE:
						opMap.put(i, "<=");
						break;
					case sym.GE:
						opMap.put(i, ">=");
						break;
					case sym.IS:
						opMap.put(i, " IS ");
						break;
					case sym.ISNOT:
						opMap.put(i, " IS NOT ");
						break;
					case sym.AND:
						opMap.put(i, " AND ");
						break;
					case sym.OR:
						opMap.put(i, " OR ");
						break;
					case sym.LIKE:
						opMap.put(i, " LIKE ");
						break;
					case sym.NOTLIKE:
						opMap.put(i, " NOT LIKE ");
						break;
				}
				
			} catch (IllegalArgumentException e)
			{
				e.printStackTrace();
			} catch (IllegalAccessException e)
			{
				e.printStackTrace();
			}
		}
	}
	
	public static String GetSym(int op)
	{
		return opMap.get(op);
	}
}
